import 'package:flutter/material.dart';
import 'package:flutter_xyf/pages/extend/scrollbar/animation_widget.dart';

class WorkItem extends StatelessWidget {
  const WorkItem({
    Key? key,
    required this.childFun,
    required this.index,
    required this.bean,
  }) : super(key: key);
  final int index;
  final String bean;
  final Function(int index, Object data) childFun;

  @override
  Widget build(BuildContext context) {
    double top = index == 0 ? 12 : 0;
    return Container(
      color: Colors.grey[200],
      padding: EdgeInsets.only(top: top, bottom: 12),
      child: buildAnimationWidget(),
    );
  }

  AnimationWidget buildAnimationWidget() {
    return AnimationWidget(
        duration: 400 + index % 3 * 100, child: this.childFun(index, bean));
  }
}
